package com.yide.myworld.mapper;

import com.yide.myworld.domain.MqFlowMiddle;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface MqFlowMiddleMapper extends BatchBaseMapper<MqFlowMiddle> {

    /**
     * 查询已发送但还没有消费的指定topic的mq消息（不管消费是否成功）
     * @param topic
     */
    @Select("SELECT * FROM `djs_mq_flow_middle` where topic = #{topic} and message_id not in (SELECT message_id FROM `djs_mq_flow` where topic = #{topic}) and message_id not in (SELECT message_id FROM `djs_mq_flow_history` where topic = #{topic})")
    List<MqFlowMiddle> selectSendButNotConsumeMessageByTopic(String topic);
}